// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from "vscode";
import CTFHoverProvider from "./keyWordParser";
import { SideList } from "./anyTooler";
import { createWebViewer } from "./webviewer";

// This method is called when your extension is activated
// Your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {
  // word hover
  const CTFhover = new CTFHoverProvider(context.extensionUri);
  context.subscriptions.push(
    vscode.languages.registerHoverProvider("php", CTFhover)
  );

  // sidebar
  const sidebar = new SideList(context.extensionUri);
  vscode.window.createTreeView("any_tool", { treeDataProvider: sidebar });
  // vscode.window.registerTreeDataProvider("any_tool", sidebar);
  vscode.commands.registerCommand("refresh_vuln", () => sidebar.refresh());

  // webview
  context.subscriptions.push(
    vscode.commands.registerCommand("open_webview", async () => {
      await createWebViewer(context.extensionUri);
    })
  );
}

// This method is called when your extension is deactivated
export function deactivate() {}
